﻿Dipan.SanGuo.Page.Today=
{
    Initialize: function()
    {
        
    },
    Template:
    ['<div class="top">',
'<div class="l">',
'</div>',
'<div class="m">',
'</div>',
'<div class="r">',
'</div>',
'</div>',
'<div class="cont">',
'<div class="title" id="drag_float" style="cursor: move;" title="拖动">',
'<div>',
'<div class="tl"></div>',
'<div class="tm white_12b">金銮殿</div>',
'<div class="tr"></div>',
'</div>',
'<div class="close">',
"<a title=\"关闭\" href=\"javascript:;\" onclick={if newbie_task<65}\"Dipan.SanGuo.Page.Fun.task(){else}\"Dipan.SanGuo.Common.CloseDialog('_float'){/if};return false;\">",
'<img alt="" border="0" src="${Dipan.SanGuo.Common.StaticsServer}/Statics/Images/float/f_11.gif" /></a></div>',
'</div>',
'</div>',
'<div class="cont">',
'<div class="container">',
'<div class="float_note">',
'<div class="yellow4 today_note">',

'<table width="100%" border="0" cellspacing="0" cellpadding="0">',
'<tr>',
'<td width="46%"><strong>今日俸禄</strong></td>',
'<td width="54%" align="right">{if nodp==0}<a class="but_12_l" href="#" onclick="return Dipan.SanGuo.Page.Today.getPassport();" title="为了更好保护您的账号，设置完整密保后系统将给予30点券的奖励，不可重复领取！">密保奖励</a>{/if}&nbsp;&nbsp;&nbsp;{if newbie_left>0}<strong>新手保护期还剩 <span class="yellow1"><span class="yellow1" id="tab_time_0">${Dipan.SanGuo.Common.Seconds2DayTime(newbie_left)}</span></span></strong>{/if}',
'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;',
'{if newbie_task<65}<a href="#" class="but_12_l" onclick="Dipan.SanGuo.Page.Fun.task();return false;">新手任务</a>(${newbie_task+1}/66){/if}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;',
'<a href="#" class="but_12_l" onclick="Dipan.SanGuo.Common.Help();return false;">帮助</a></td>',
'</tr>',
'</table>',


'</div>',
'<div>',
'<div class="today_images"><img src="${Dipan.SanGuo.Common.StaticsServer}/Statics/Images/headimg/${head_img}.jpg" alt="" width="130" height="93" /></div>',
'<div class="today_m">',
'<div class="float_info_content">',
'<ul>',
'<li>',
'{var arr=Dipan.SanGuo.Page.Today.guanfun(famous,credit)}',
'<div class="left pink">主&nbsp;&nbsp;公：</div>',
'<div class="right yellow2">${name}</div>',
'</li>',
'<li>',
'<div class="left pink">声&nbsp;&nbsp;望：</div>',
'<div class="right yellow2">${credit} <font class="pink">[${arr[2]}级]</font></div>',
'</li>',
'<li>',
'<div class="left pink">威&nbsp;&nbsp;望：</div>',
'<div class="right yellow2">${famous} <font class="pink">[${arr[1]}级]</font></div>',
'</li>',
'<li>',
'<div class="left pink">官&nbsp;&nbsp;职：</div>',
'<div class="right yellow2">${arr[0]}</div>',
'</li>',
'</ul>',
'</div>',
'</div>',
'<div class="today_r">',
'<div class="today_bg red2 font14 bold">今日俸禄：${salary}&nbsp;<span class="yellow2">铜钱</span>{if bonus_ticket>0}&nbsp;&nbsp;${bonus_ticket}<span class="yellow2">点券</span>{/if}</div>',
'<span class="today_but ">{if has_got==0}<a class="but_12 bun_n" href="#" onclick="Dipan.SanGuo.Page.Today.gettoday();return false;">领取</a>{/if}</span> </div>',
'</div>',
'</div>',
'<div class="float_note">',
'<div class="yellow4 today_note"><strong>&nbsp;&nbsp;&nbsp;告示天下</strong></div>',
'<div class="today_content">',
'<div class="today_content">',
'<ul id="_gs_xf_show">',
'<li><div class="tab2_12">正在读取公告信息.....</div></li>',
'</ul>',
'</div>',
'</div>',
'<div class="today_pic">',
'<ul id="_hdshow">',
'</ul>',
'</div>',
'<div></div>',
'</div>',

'</div>',
'<div class="top">',
'<div class="bl">',
'</div>',
'<div class="bm">',
'</div>',
'<div class="br">',
'</div>',
'</div>',
'</div>'],
    hd_show:['{for p in list}',
    '<li><a href="${p.link}" target="_blank">',
    '<img src="${p.img}" width="210" height="60" broder="0" /></a></li>',
    '{/for}',
    ],
    guanfun:function(famous,credit)
    {
        var www=this.weiwang.split(',');
        var sss=this.shengwang.split(',');
        var wwlv=0;sslv=0;
        for(var i=0;i<this.guan.length;i++)
        {
            if(famous<=www[i]*1)
            {
                wwlv=i;
                break;
            }
        }
        if(i==this.guan.length)wwlv=(i-1);
        for(var i=0;i<this.guan.length;i++)
        {
            if(credit<=sss[i]*1)
            {
                sslv=i;
                break;
            }
        }
        if(i==this.guan.length)sslv=(i-1);
        var num=Math.min(wwlv,sslv);
        var arry=new Array();
        arry[0]=this.guan[num][0];
        arry[1]=wwlv;
        arry[2]=sslv;
        return arry;
    },
    /**
    *   读取活动信息
    */
    gethd:function()
    {
        var RemoteData = new Dipan.SanGuo.Common.RemoteData()
        RemoteData.Post("/GateWay/Common.ashx?id=56","");
        RemoteData.onComplete = function(resp)
        {
            try
                {
                var JsonData = eval('(' + resp + ')');
                if (JsonData.ret * 1 == 0)
                {
                    Dipan.SanGuo.Common.FixData(Dipan.SanGuo.Page.Today.hd_show, "_hdshow", JsonData,true);
                    //new Draggable("drag_float", true);
                }
                else
                    //返回不成功后到统一方法处理错误信息
                    alert('读取活动信息失败.');
           }
           catch(e)
           {
                alert(e.message);
           }
        }
    },
    today:function(id)
    {
        var RemoteData = new Dipan.SanGuo.Common.RemoteData()
        RemoteData.Post("/GateWay/Common.ashx?id=47","");
        RemoteData.onComplete = function(resp)
        {
            var JsonData = eval('(' + resp + ')');
            if (JsonData.ret * 1 == 0)
            {
                if(JsonData.has_got*1==1&&id==1)
                {
                    Dipan.SanGuo.Common.SetCookie('today','0');
                    return;
                }
                Dipan.SanGuo.Common.FixData(Dipan.SanGuo.Page.Today.Template, "_float", JsonData);
                Dipan.SanGuo.Page.Today.gethd();
                new Draggable("drag_float", true);
                Dipan.SanGuo.Common.TimeSpan2('Build.Today.today('+id+')');
                if($F("channel_big")*1==-4)
                {
                    if ($("msglist"))
                        $("msglist").innerHTML = "";
                }
                Dipan.SanGuo.Broadcast.Movie('talk').reqsmsg_fun();
            }
            else
                //返回不成功后到统一方法处理错误信息
                Dipan.SanGuo.Common.ResultInfo(JsonData.ret);
        }
    },
    gettoday:function()
    {
        var RemoteData = new Dipan.SanGuo.Common.RemoteData();
        RemoteData.Post("/GateWay/OPT.ashx?id=63","");
        RemoteData.onComplete = function(resp)
        {
            var JsonData = eval('(' + resp + ')');
            if (JsonData.ret * 1 == 0)
            {   
                alert('领取成功');
                Dipan.SanGuo.Common.SetCookie('today','0');
                Dipan.SanGuo.Common.F6();
                Dipan.SanGuo.Page.Today.today();
            }
            else
                //返回不成功后到统一方法处理错误信息
                Dipan.SanGuo.Common.ResultInfo(JsonData.ret);
        }
    },
    getPassport:function()
    {
        var RemoteData = new Dipan.SanGuo.Common.RemoteData();
        RemoteData.Post("/GateWay/OPT.ashx?id=88","");
        RemoteData.onComplete = function(resp)
        {
            var JsonData = eval('(' + resp + ')');
            if (JsonData.ret * 1 == 0)
            {   
                alert('领取成功');
                Dipan.SanGuo.Page.Today.today();
            }
            else if(JsonData.ret * 1<0)
            {
                    alert('您未设置密码保护或密保资料不完整，无法领取奖励<br><a target="_blank"  class="but_12_l" href="http://pass.dipan.com/m.aspx?cn=PassProtect">点击设置密码保护</a>');
            }
            else
                //返回不成功后到统一方法处理错误信息
                Dipan.SanGuo.Common.ResultInfo(JsonData.ret);
        }
        return false;
    },
    weiwang:"0,600,1300,2100,3100,4300,5700,7400,9400,11800,14700,18200,22400,27400,33400,40600,49200,59500,71900,85000,100000,115000,130000,145000,160000,175000,190000,205000,220000,235000,250000,265000,280000,295000,310000,325000,340000,355000,370000,385000,400000,415000,430000,445000,460000,475000,490000,505000,520000,535000,550000,565000,580000,595000,610000,625000,640000,655000,670000,685000,700000,715000,730000,745000,760000,775000,790000,805000,820000,835000,850000,865000,880000,895000,910000,925000,940000,955000,970000,985000,1000000,1015000,1030000,1045000,1060000,1075000,1090000,1105000,1120000,1135000,1150000,1165000,1180000,1195000,1210000,1225000,1240000,1255000,1270000,1285000,1300000",
    shengwang:"0,1000,1500,2100,4000,6300,9000,13000,19000,28000,47000,70000,99000,135000,340000,620000,1000000,1500000,2000000,2500000,3000000,3500000,4000000,4500000,5000000,5500000,6000000,7000000,8000000,9000000,10000000,11000000,12000000,13000000,14000000,15000000,16000000,17000000,18000000,19000000,20000000,21000000,22000000,23000000,24000000,25000000,26000000,27000000,28000000,29000000,30000000,31000000,32000000,33000000,34000000,35000000,36000000,37000000,38000000,39000000,40000000,41000000,42000000,43000000,44000000,45000000,46000000,47000000,48000000,49000000,50000000,51000000,52000000,53000000,54000000,55000000,56000000,57000000,58000000,59000000,60000000,61000000,62000000,63000000,64000000,65000000,66000000,67000000,68000000,69000000,70000000,71000000,72000000,73000000,74000000,75000000,76000000,77000000,78000000,79000000,80000000,81000000,82000000,83000000,84000000,85000000,86000000,87000000,88000000,89000000,90000000,91000000,92000000,93000000,94000000,95000000,96000000,97000000,98000000,99000000,100000000,101000000,102000000,103000000,104000000,105000000,106000000,107000000",
    guan:[
        ["义兵",0,0],
        ["督邮",600,600],
        ["校尉",1300,1300],
        ["校事",2100,2100],
        ["参军",3100,3100],
        ["县令长",4300,4300],
        ["太守",5700,5700],
        ["从事",7400,7400],
        ["州牧",9400,9400],
        ["刺史",11800,11800],
        ["侍中",14700,14700],
        ["尚书",18200,18200],
        ["执金吾",22400,22400],
        ["中郎将",27400,27400],
        ["长史",33400,33400],
        ["中常侍",40600,40600],
        ["征北将军",49200,49200],
        ["征西将军",195800,195800],
        ["征南将军",2395000,2395000],
        ["征东将军",2874000,2874000],
        ["车骑将军",3448800,3448800],
        ["骠骑将军",4138600,4138600],
        ["光禄勋",4966300,4966300],
        ["司隶",5959600,5959600],
        ["卫尉",7151500,7151500],
        ["太尉",8581800,8581800],
        ["廷尉",10298200,10298200],
        ["少府",12357800,12357800],
        ["太仆",14829400,14829400],
        ["太常",17795300,17795300],
        ["太傅",21354400,21354400],
        ["御史中丞",25625300,25625300],
        ["御史大夫",30750400,30750400],
        ["大鸿胪",36900500,36900500],
        ["大司农",44280600,44280600],
        ["司空",53136700,53136700],
        ["司徒",6376400,6376400],
        ["司马",76516800,76516800],
        ["大将军",91820200,91820200],
        ["丞相",110184200,110184200]
    ]
}
